home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH6 / 6-2-5.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-16  |  2.4 KB  |  83 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPhone 
  3.    Caption         =   "Phone Number"
  4.    ClientHeight    =   1725
  5.    ClientLeft      =   1215
  6.    ClientTop       =   1650
  7.    ClientWidth     =   2655
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   1725
  20.    ScaleWidth      =   2655
  21.    Begin VB.TextBox txtName 
  22.       Height          =   285
  23.       Left            =   1680
  24.       TabIndex        =   1
  25.       Top             =   120
  26.       Width           =   855
  27.    End
  28.    Begin VB.PictureBox picNumber 
  29.       Height          =   255
  30.       Left            =   120
  31.       ScaleHeight     =   195
  32.       ScaleWidth      =   2355
  33.       TabIndex        =   3
  34.       Top             =   1320
  35.       Width           =   2415
  36.    End
  37.    Begin VB.CommandButton cmdDisplay 
  38.       Caption         =   "Display Phone Number"
  39.       Height          =   495
  40.       Left            =   120
  41.       TabIndex        =   2
  42.       Top             =   600
  43.       Width           =   2415
  44.    End
  45.    Begin VB.Label lblName 
  46.       Alignment       =   1  'Right Justify
  47.       Caption         =   "Name to look up"
  48.       Height          =   255
  49.       Left            =   120
  50.       TabIndex        =   0
  51.       Top             =   120
  52.       Width           =   1455
  53.    End
  54. Attribute VB_Name = "frmPhone"
  55. Attribute VB_GlobalNameSpace = False
  56. Attribute VB_Creatable = False
  57. Attribute VB_PredeclaredId = True
  58. Attribute VB_Exposed = False
  59. Private Sub cmdDisplay_Click()
  60.   Dim foundFlag As Boolean, fileName As String
  61.   Dim nom As String, phoneNum As String
  62.   Open App.Path & "\LISTS.TXT" For Input As #1
  63.   foundFlag = False
  64.   nom = ""
  65.   Do While (foundFlag = False) And (Not EOF(1))
  66.     Input #1, fileName
  67.     Open App.Path & "\" & fileName For Input As #2
  68.     Do While (nom <> txtName.Text) And (Not EOF(2))
  69.       Input #2, nom, phoneNum
  70.     Loop
  71.     Close #2
  72.     picNumber.Cls
  73.     If nom = txtName.Text Then
  74.         picNumber.Print nom, phoneNum
  75.         foundFlag = True
  76.     End If
  77.   Loop
  78.   Close #1
  79.   If foundFlag = False Then
  80.       picNumber.Print "Name not found."
  81.   End If
  82. End Sub
  83.